using System;
using System.Collections.Generic;
using System.Text;
using Ricciolo.StylesExplorer.MarkupReflection;

namespace Ricciolo.StylesExplorer.Model
{
    class ApplicationCollection : ObservableCollection<IApplication>
    {

        private AssemblyResolveEventHandler assemblyResolve;

        public ApplicationCollection(AssemblyResolveEventHandler assemblyResolve)
        {
            this.assemblyResolve = assemblyResolve;
        }

        protected override void InsertItem(int index, IApplication item)
        {
            base.InsertItem(index, item);

            item.AssemblyResolve += assemblyResolve;
        }

        protected override void RemoveItem(int index)
        {
            this[index].AssemblyResolve -= assemblyResolve;
            base.RemoveItem(index);
        }
    }
}
